using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_PhysicianStatMap : EntityTypeConfiguration<so_PhysicianStat>
    {
        public so_PhysicianStatMap()
        {
            // Primary Key
            this.HasKey(t => new { t.PHYSICIAN, t.ITEM, t.Item_Description, t.SUMFIELDS, t.DIMFIELDS });

            // Properties
            this.Property(t => t.PHYSICIAN)
                .IsRequired()
                .HasMaxLength(35);

            this.Property(t => t.ITEM)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.Item_Description)
                .IsRequired()
                .HasMaxLength(250);

            this.Property(t => t.Month)
                .HasMaxLength(2);

            this.Property(t => t.Year)
                .HasMaxLength(4);

            this.Property(t => t.SUMFIELDS)
                .IsRequired()
                .HasMaxLength(17);

            this.Property(t => t.DIMFIELDS)
                .IsRequired()
                .HasMaxLength(39);

            // Table & Column Mappings
            this.ToTable("so_PhysicianStat");
            this.Property(t => t.PHYSICIAN).HasColumnName("PHYSICIAN");
            this.Property(t => t.ITEM).HasColumnName("ITEM");
            this.Property(t => t.Item_Description).HasColumnName("Item_Description");
            this.Property(t => t.Services_number).HasColumnName("Services_number");
            this.Property(t => t.Month).HasColumnName("Month");
            this.Property(t => t.Year).HasColumnName("Year");
            this.Property(t => t.SUMFIELDS).HasColumnName("SUMFIELDS");
            this.Property(t => t.DIMFIELDS).HasColumnName("DIMFIELDS");
        }
    }
}
